<?php
/*
 * name: gsl
 * desc: 平台用户 迁移表
 * date: 2018/09/21
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateAdminUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_user', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('username',20)->comment('用户名');
            $table->string('name',30)->comment('昵称');
            $table->string('phone',15)->nullable()->comment('手机号');
            $table->string('password',100)->comment('密码');
            $table->tinyInteger('user_type')->default(1)->comment('用户类型  默认2普通管理员,1超级管理员');
            $table->integer('avatar')->nullable()->comment('头像 关联file表id');
            $table->tinyInteger('status')->default(1)->comment('状态  默认1正常\2冻结');
            $table->timestamps();
            $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."admin_user` comment'平台用户'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_user');
    }
}
